import time

from Base import Base

from selenium.webdriver.common.by import By

from time import sleep

class Page(Base):
    #定位器
    search_loc=(By.ID,'kw') #百度搜索
    click1=(By.ID,'su') #百度搜索按钮
    #设置
    set_sench=(By.NAME,'tj_settingicon')
    #点击高级搜索
    set_char=(By.LINK_TEXT,'高级搜索')
    #搜索结果
    set11=(By.ID,'adv_keyword')

    set12=(By.NAME,'q3')
    # #页面元素的封装
    #输入框
    def search(self):
        # self.find_element(self.search_loc).send_keys('web端自动化')
        #对话框的定位器进行输入操作
        self.send_keys(self.search_loc,'web端自动化')

    #点击按钮
    def baidu(self):
        self.click(self.click1)

    #键盘框
    def ctrl_a(self):
        self.keyboard(self.search_loc,'a')

    def ctrl_c(self):
        self.keyboard(self.search_loc,'c')

    #点击设置
    def set1(self):
        self.mouse(self.set_sench)

    #点击高级搜索
    def advancedSearch(self):
        self.click(self.set_char)


    #输入搜索结果
    def ctrl_v(self):
        self.keyboard(self.set11,'v')
        self.selectAll(self.set11)
        self.keyboard(self.set11,'c')
    def doubleClick(self):
        self.keyboard(self.set12,'v')
    #业务逻辑
    def baidu_luoji(self):
        self.open_url('http://www.baidu.com/')
        self.search()
        self.baidu()
        self.ctrl_a()
        self.set1()
        self.advancedSearch()
        self.ctrl_c()
        self.ctrl_v()
        self.doubleClick()






